<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
<h:head></h:head>
<h:form>
    
    <rich:toolbar>
        <rich:toolbarGroup>
            <h:commandLink value="Добавить пользователя" 
                           action="#{wuserBoundary.doCreateNewUser()}"/>
        </rich:toolbarGroup>
        <rich:toolbarGroup location="right">
            <h:commandLink value="На главную" 
                           action="#{wuserBoundary.doExitToMain()}"/>
        </rich:toolbarGroup>
    </rich:toolbar>
    <br/>
    <center>
    <rich:dataTable id="userlistTable" value="#{wuserBoundary.wuserList}" 
                    var="wulst" >
        <rich:column>
            <f:facet name="header">ID</f:facet>
            <h:outputText value="#{wulst.id}"/>           
        </rich:column>
        <rich:column sortBy="#{wulst.name}">
            <f:facet name="header">Имя</f:facet>
            <h:outputText value="#{wulst.name}"/>
        </rich:column>
        <rich:column>
            <f:facet name="header">Эл.почта</f:facet>
            <h:outputText value="#{wulst.email}"/>
        </rich:column>
        <rich:column>
            <f:facet name="header">Права</f:facet>
            <h:outputText value="#{wulst.wuserRole}"/>
        </rich:column>
        <rich:column sortBy="#{wulst.companyByDefault}">
            <f:facet name="header">Организация</f:facet>
            <h:outputText value="#{wulst.companyByDefault.toString()}"/>
        </rich:column>
        <rich:column sortBy="#{wulst.warehouseByDefault}">
            <f:facet name="header">Склад</f:facet>
            <h:outputText value="#{wulst.warehouseByDefault.toString()}"/>
        </rich:column>
        <rich:column>
            <f:facet name="header">Валюта</f:facet>
            <h:outputText value="#{wulst.currencyByDefault.toString()}"/>
        </rich:column>
        <rich:column>
            <a4j:commandLink execute="@this"
                render="@none" oncomplete="#{rich:component('confirmPane')}.show()">
                <h:graphicImage value="/images/delete.gif" alt="delete" />
                <a4j:param value="#{wulst.id}"
                           assignTo="#{wuserBoundary}" />
            </a4j:commandLink>
            <a4j:commandLink render="editGrid"
                execute="@this" oncomplete="#{rich:component('editPane')}.show()">
                <h:graphicImage value="/images/edit.gif" alt="edit"/>
                <a4j:param value="#{it.index}"
                    assignTo="#{carsBean.currentCarIndex}" />
                <f:setPropertyActionListener target="#{carsBean.editedCar}"
                    value="#{car}" />
            </a4j:commandLink>
            </rich:column>
    </rich:dataTable>
    </center>
    <rich:popupPanel id="confirmPane" autosized="true">
        Пометить на удаление?
        <a4j:commandButton value="Отмена"
            onclick="#{rich:component('confirmPane')}.hide(); return false;" />
        <a4j:commandButton value="Пометить" 
            onclick="remove(); return false;" />
    </rich:popupPanel>
</h:form>
</html>
